/*
 * @Author: lrren01
 * @Date: 2024-08-15 09:54:01
 * @LastEditors: lrren01
 * @LastEditTime: 2024-09-18 11:39:45
 * @Description: 
 */
import {
  Select,
  SelectContent,
  SelectGroup,
  SelectItem,
  SelectTrigger,
} from "./ui/select";
import { GeneratedCodeConfig } from "../types";

function generateDisplayComponent(config: GeneratedCodeConfig) {
  switch (config) {
    case GeneratedCodeConfig.REACT_ANTD:
      return (
        <div>
          <span className="font-semibold">React</span> +{" "}
          <span className="font-semibold">AntD</span>
        </div>
      );  
      case GeneratedCodeConfig.OPENINULA:
        return (
          <div>
            <span className="font-semibold">OpenInula</span> 
          </div>
        ); 
    default:
      return config;
  }
}

interface Props {
  generatedCodeConfig: GeneratedCodeConfig;
  setGeneratedCodeConfig: (config: GeneratedCodeConfig) => void;
  shouldDisableUpdates?: boolean;
}

function OutputSettingsSection({
  generatedCodeConfig,
  setGeneratedCodeConfig,
  shouldDisableUpdates = false,
}: Props) {
  return (
    <div className="flex flex-col gap-y-2 justify-between text-sm">
      <div className="w-[200px]">
        <Select
          value={generatedCodeConfig}
          onValueChange={(value: string) =>
            setGeneratedCodeConfig(value as GeneratedCodeConfig)
          }
          disabled={shouldDisableUpdates}
        >
          <SelectTrigger className="col-span-2" id="output-settings-js">
            {generateDisplayComponent(generatedCodeConfig)}
          </SelectTrigger>
          <SelectContent>
            <SelectGroup>
              <SelectItem value={GeneratedCodeConfig.REACT_ANTD}>               {generateDisplayComponent(GeneratedCodeConfig.REACT_ANTD)}
              </SelectItem>
              <SelectItem value={GeneratedCodeConfig.OPENINULA}>
                {generateDisplayComponent(GeneratedCodeConfig.OPENINULA)}
              </SelectItem>
            </SelectGroup>
          </SelectContent>
        </Select>
      </div>
    </div>
  );
}

export const TechnologyStackList = [
  {
    label: GeneratedCodeConfig.REACT_ANTD,
    value: 'react + antd'
  },
  {
    label: GeneratedCodeConfig.OPENINULA,
    value: 'openinula'
  },
]



export default OutputSettingsSection;
